﻿<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>添加管理员</title>
<style type="text/css">
	.labelone{
		width: 50%;
		height: 200px;
		margin: 4% auto;
	}
	.title{
		margin: 0 0 15% 0;
	}
	.thebtn{
		height: 2rem;
		width: 5rem;
		border: none;
		background-color: #4cb9f1;
		cursor: pointer;
	}
</style>
</head>
<body>
<div class="labelone">
	<div class="title">
		<label class="">账号名称：<input type="text" placeholder="请填写管理员名称" value="" class="input-text" style="height: 1.5rem; width: 50%;" id="adminname"></label><br><br>
		<label class="">登录密码：<input type="text" placeholder="请填写登录密码" value="" class="input-text" style="height: 1.5rem; width: 50%;" id="adminpassword"></label><br><br>
		<label class="">确认密码：<input type="text" placeholder="请再次确认密码" value="" class="input-text" style="height: 1.5rem; width: 50%;" id="readminpassword"></label>
	</div>
	<div class="title">
		<label class="">管理角色：</label>
		<select name="selected" style="height: 2rem; width: 50%;" id="selected">
			<option value="1">超级管理员</option>
			<option value="2">普通管理员</option>
		</select>
	</div>
	<div class="">
		<div class="" style="margin-left: 30%;">
			<input type="button" name="" onclick="tijiao()" value="添加" class="thebtn">
		</div>
	</div>
</div>
<script type="text/javascript" src="../lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="../static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="../lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="../static/h-ui.admin/js/H-ui.admin.js"></script>
<script type="text/javascript">
function tijiao() {
    var adminname=document.getElementById('adminname').value;
    var adminpassword=document.getElementById('adminpassword').value;
    var readminpassword=document.getElementById('readminpassword').value;
    var selected=document.getElementById('selected').value;
	$.ajax({
	    url: "{{url('/admin/adminlist/tobeadd')}}",
	    data: {
	        "adminname": adminname,
	        "adminpassword": adminpassword,
	        "readminpassword":readminpassword,
	        "selected":selected,
	        '_token': "{{csrf_token()}}"
	    },
	    type: 'POST',
	    dataType: 'json',
	    success: function(result){
	      	if(result.status == 'true'){
	          	layer.msg(result.msg,{icon:6});
	          	setTimeout(function(){
	              	//window.location.reload();
	              	//window.parent.location.href="{{url('admin/getout')}}";
	              	window.parent.location.reload();
	          	},3000)
	      	}else{
	          	layer.msg(result.msg,{icon:5,time:2000});
	          	return false;
	      	}
	  	},
	});
}
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>
